<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>v-once</h1>
    <p>用于指定标签，内容挂载之后，即使数据发生了变化，也不更改内容。</p>
    <main id="app">
        <p>不使用v-once指令：{{num}}</p>
        <p v-once>使用v-once指令：{{num}}</p>
        <!-- <p v-once v-if="num % 2 == 1">v-if：{{num}}</p>
        <p v-once v-show="num % 2 == 1">v-show：{{num}}</p> -->
    </main>
    <script src="../vue.min.js"></script>
    <script>
        let vue = new Vue({
            el: "#app",
            data() {
                return {
                    num: 0,
                }
            },
        })

        setInterval(() => {
            vue.num ++;
        }, 1000);
    </script>

</html>